from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel

class ChatBase(BaseModel):
    participants: List[str]
    type: str  # 'user_to_user', 'user_to_ai'

class ChatCreate(ChatBase):
    pass

class ChatUpdate(BaseModel):
    participants: Optional[List[str]] = None
    type: Optional[str] = None

class Chat(ChatBase):
    id: str
    created_at: datetime
    updated_at: datetime
    last_message_id: Optional[str] = None